package com.example.sysao.service.impl;

import com.example.sysao.mapper.TechnicianMapper;
import com.example.sysao.pejo.Technician;
import com.example.sysao.service.TechnicianService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TechnicianServiceImp implements TechnicianService {
    @Resource
    private TechnicianMapper technicianMapper;

    @Override
    public List<Technician> findAll() {
        return technicianMapper.selectAll();
    }

    @Override
    public List<Technician> findByType(String type) {
        return technicianMapper.selectByType(type);
    }

    @Override
    public boolean removeTechnician(int id) {
        return technicianMapper.deleteTechican(id) != 0;
    }

    @Override
    public Technician finsById(int id) {
        return technicianMapper.selectById(id);
    }

    @Override
    public boolean saveTechnician(Technician technician) {
        return technicianMapper.updateTechnician(technician) != 0;
    }

    @Override
    public boolean addTechnician(Technician technician) {
        return technicianMapper.insertTechnician(technician) != 0;
    }
}
